package leetcode;

public class a404左叶子之和 {
    public int sumOfLeftLeaves(TreeNode root) {
        if (root==null||(root.left==null&&root.right==null)) return 0;
        int left=sumOfLeftLeaves(root.left);
        if (root.left!=null&&root.left.left==null&&root.left.right==null){
            left=root.left.val;
        }
        int right=sumOfLeftLeaves(root.right);

        return left+right;

    }

}
